/**
 * @author kangkai
 */
package cn.edu.tju.mining.kangkai.servlet;

import java.io.IOException;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import cn.edu.tju.mining.Factory;
import cn.edu.tju.mining.vo.report.Report;

@SuppressWarnings("serial")
public class ChartServlet extends HttpServlet {

	public ChartServlet() {
		super();
	}

	public void destroy() {
		super.destroy(); 
	}

	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		String rid = request.getParameter("rid");
		Report report = Factory.servReport.getReportById(rid);
		request.getSession().setAttribute("highchartJsScript", report.getDataSet().getHighchartJsString());
		RequestDispatcher requestDispatcher=request.getRequestDispatcher("/chart/chart.jsp");   
		requestDispatcher.forward(request,response);
	}

	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		doGet(request, response);
	}

	public void init() throws ServletException {
	}

}
